/*
 * Decompiled with CFR 0.150.
 * 
 * Could not load the following classes:
 *  cn.hutool.crypto.SecureUtil
 *  com.alibaba.fastjson.JSON
 */
package com.gys.common.business;

import cn.hutool.crypto.SecureUtil;
import com.alibaba.fastjson.JSON;
import com.gys.common.data.HttpJson;
import com.gys.common.util.ConstUtil;
import com.gys.common.util.HttpClientUtil;
import java.io.File;
import java.util.HashMap;
import java.util.Map;

public class GysUtil {
    public static HttpJson loginByAcoount(String account, String password) {
        HashMap<String, String> param = new HashMap<String, String>();
        param.put("username", account);
        param.put("password", SecureUtil.md5((String)password));
        return HttpClientUtil.httpPostJson(ConstUtil.HTTP_URL + "/auth/operation/login", JSON.toJSONString(param));
    }

    public static HttpJson getCode(String phone) {
        HashMap<String, String> param = new HashMap<String, String>();
        param.put("phone", phone);
        return HttpClientUtil.httpPostJson(ConstUtil.HTTP_URL + "/auth/operation/getSmsCode", JSON.toJSONString(param));
    }

    public static HttpJson LoginByPhone(String phone, String code) {
        HashMap<String, String> param = new HashMap<String, String>();
        param.put("phone", phone);
        param.put("code", code);
        return HttpClientUtil.httpPostJson(ConstUtil.HTTP_URL + "/auth/operation/loginByPhone", JSON.toJSONString(param));
    }

    public static HttpJson chooseStore(Map<String, String> param) {
        return HttpClientUtil.httpPostJson(ConstUtil.HTTP_URL + "/auth/operation/chooseStore", JSON.toJSONString(param));
    }

    public static HttpJson getResByUser() {
        HashMap param = new HashMap();
        return HttpClientUtil.httpPostJson(ConstUtil.HTTP_URL + "/auth/operation/getResByUser", JSON.toJSONString(param));
    }

    public static HttpJson restPassword(Map<String, String> param) {
        return HttpClientUtil.httpPostJson(ConstUtil.HTTP_URL + "/auth/updatePassword", JSON.toJSONString(param));
    }

    public static HttpJson upload(File file) {
        return HttpClientUtil.httpPostFile(ConstUtil.HTTP_URL + "/auth/common/file/upload", file);
    }
}

